<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>m
<body>
<a href="/tosave">添加</a>
<table>
    <tr>
        <th>序号</th>
        <th>用户名</th>
        <th>密码</th>
        <th>性别</th>
        <th>数量</th>
        <th>操作</th>
    </tr>
    <tr th:each="u : ${users}">
        <td th:text="${u.id}"></td>
        <td th:text="${u.username}"></td>
        <td th:text="${u.password}"></td>
        <td th:text="${u.sex}"></td>
        <td th:text="${u.updateCount}"></td>
        <td>
            <button th:onclick="|del(${u.id})|">删除</button>
            <a th:href="@{/findById(id=${u.id})}">更新</a>
        </td>
    </tr>

</table>
</body>
<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
<script>

    function del(id){
        $.get("/del?id="+id,function (res) {
            if (res.code == 200){
                //刷新页面
                    location.reload()
            }else {
                alert("删除失败")
            }
        })
    }



</script>



</html>